package com.drojian.thread;

public class SellTicket2 implements Runnable {
     int ticket = 1;

    @Override
    public void run() {
        while (true){
            if(aa()) break;
        }
    }
    private synchronized boolean aa() {
        if (ticket == 101) {
            return true;
        }else {
            System.out.println(Thread.currentThread().getName() + "卖票，票号为：" + ticket);
            ticket++;

        }

        return false;
    }
}
